#include<iostream>
#include<vector>
#include<cctype>
#include<string>
typedef long long ll;
const int N = 200;
using namespace std;
vector<string> mp;
string high_multi(string& s1)
{
	int a[N], b[N], c[N];
	int la = s1.size();
	for (int i = 0; i < la; i++)
	{
		a[i] = s1[la - i - 1] - '0';
	}
	for (int i = 0; i < la; i++)
	{
		for (int j = 0; j < la; j++)
		{
			b[i + j] += a[i] + a[j];
		}
	}
	int lb = 2 * la;
	for (int i = 0; i < lb; i++)
	{
		b[i + 1] += b[i] / 10;
		b[i] %= 10;
	}string s5;
	while (b[lb - 1] == 0 && lb > 1) lb--;
	for (int i = 0; i < lb; i++)
	{
		s5 += to_string(b[i]);
	}
	return s5;
}
int main()
{
	int t;cin >> t;
	while (t--)
	{
		string s1, s2;cin >> s1 >> s2;
		while (s1.size() <= 18)
		{
			mp.push_back(s1);
			s1 = high_multi(s1);
		}

	}
	return 0;
}